import { useToggle, useBattery } from 'react-use'

function MyToggle() {
    const [isOn, toggle] = useToggle(true)
    return <div>
        {isOn ? '开' : '关'}
        <button onClick={toggle}>切换开关</button>
    </div>
}

function BatteryStatus() {
    const state = useBattery();

    return <pre>{JSON.stringify(state, null, 2)}</pre>;
};
export { MyToggle, BatteryStatus }